<template>
	<view v-if="isHaveConsultation" class="rx-before-content">
		<view class="user-info">
			<view class="zh-table-view">
				<view class="zh-table-view-cell">
					<view class="common-tip">
						<image src="@/pagesSub-Five/static/images/001.png" mode=""></image>
						<view>用药基础信息</view>
					</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">用药人姓名</view>
					<view class="zh-label-extra">{{patientInfo.name}}</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">身份证号</view>
					<view class="zh-label-extra">{{patientInfo.idCard}}</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">手机号</view>
					<view class="zh-label-extra">{{patientInfo.phone}}</view>
				</view>
			</view>
			<view class="zh-table-view-cell">
				<view class="zh-label">性别</view>
				<view class="zh-label-extra">{{patientInfo.sex==1?'男':'女'}}</view>
			</view>
			<view class="zh-table-view-cell" v-if="patientInfo.sex==2">
				<view class="zh-label">孕妇</view>
				<view class="zh-label-extra">
					<radio-group @change="pregnantChange">
						<label>
							<radio value="1" color="#4DCBBD" style="transform:scale(0.7)" /><text>是</text>
						</label>
						<label style="margin-left: 20rpx;">
							<radio value="0" color="#4DCBBD" style="transform:scale(0.7)" /><text>否</text>
						</label>
					</radio-group>
				</view>
			</view>
			<view class="zh-table-view-cell" v-if="patientInfo.sex==2">
				<view class="zh-label">哺乳期</view>
				<view class="zh-label-extra">
					<radio-group @change="feedChange">
						<label>
							<radio value="1" color="#4DCBBD" style="transform:scale(0.7)" /><text>是</text>
						</label>
						<label style="margin-left: 20rpx;">
							<radio value="0" color="#4DCBBD" style="transform:scale(0.7)" /><text>否</text>
						</label>
					</radio-group>
				</view>
			</view>
			<view class="zh-table-view-cell">
				<view class="zh-label">与您关系</view>
				<view class="zh-label-extra">
					<picker @change="relationshipChange" :value="relationshipArrayIndex" :range="relationshipArray">
						<view class="uni-input">{{relationshipArray[relationshipArrayIndex]}}&nbsp;>&nbsp;</view>
					</picker>
				</view>
			</view>
			<!-- 			<view class="zh-table-view-cell">
				<view class="zh-label">服务类型</view>
				<view class="zh-label-extra">
					<radio-group @change="serviceTypeChange">
						<label>
							<radio value="0" checked color="#4DCBBD" style="transform:scale(0.7)" /><text>图文</text>
						</label>
						<label style="margin-left: 20rpx;">
							<radio value="1" color="#4DCBBD" style="transform:scale(0.7)" /><text>视频</text>
						</label>
					</radio-group>
				</view>
			</view> -->
		</view>
		<view class="medicine-info">
			<view class="zh-table-view">
				<view class="zh-table-view-cell">
					<view class="common-tip">
						<image src="@/pagesSub-Five/static/images/003.png"></image>
						<view>已选药品</view>
					</view>
				</view>
				<!-- 西药信息 -->
				<view v-if="!drugState">
					<view class="zh-table-view-cell flexStyle" v-for="(item,index) in productList" :key="index">
						<view class="zh-label flexStyle">
							<image class="drugImage" :src="item.img" mode="aspectFill"></image>
							{{item.name}}{{item.specification}}
						</view>
						<view class="zh-label-extra">×{{item.count}}</view>
					</view>
				</view>
				<!-- 中药信息 -->
				<view v-if="drugState">
					<view v-for="(item,index) in productList" :key="index" class="zh-table-view-cell flexStyle">
						<view class="zh-label flexStyle">
							<image class="drugImage" :src="item.img" mode="aspectFill"></image>
							{{item.name}}{{item.specification}}
						</view>
						<view class="zh-label-extra">{{item.count}}剂</view>
					</view>
				</view>
			</view>
		</view>
		<view class="symptom-info">
			<view class="zh-table-view" v-if="!drugState">
				<view class="zh-table-view-cell">
					<view class="common-tip">
						<image src="@/pagesSub-Five/static/images/002.png"></image>
						<view>请选择已确诊疾病</view>
					</view>
					<view style="font-size: 28rpx;" @click="clearSymptomSelected">清空</view>
				</view>
				<view class="zh-table-view-cell" style="padding: 0 20rpx;">
					<view class="symptom-view">
						<view v-for="(item,index) in symptomArray" v-if="index<7" :key="item.text"
							class="symptom-view-cell" @click="symptomChoose(index)"
							:class="{'symptom-active':item.active}">
							{{item.text}}
						</view>
						<view class="symptom-view-cell" @click="showSymptomMore">
							其他 ···
						</view>
					</view>
				</view>
			</view>
			<view class="zh-table-view" v-if="drugState">
				<view class="zh-table-view-cell">
					<view class="common-tip">
						<image src="@/pagesSub-Five/static/images/002.png"></image>
						<view>请添加您的症状</view>
					</view>
					<view style="font-size: 28rpx;" @click="clearSymptomSelectedZY">清空</view>
				</view>
				<view class="zh-table-view-cell" style="padding: 0 20rpx;">
					<view class="symptom-view">
						<view v-for="(item,index) in symptomSelectedZY" :key="item.text" class="symptom-view-cell"
							@click="symptomChooseZY(index)" :class="{'symptom-active':item.active}">
							{{item.text}}
							<view style="margin-left: 10rpx;">x</view>
						</view>
						<view class="symptom-view-cell" @click="showSymptomMoreZY">添加</view>
					</view>
				</view>
			</view>
		</view>
		<view class="medicine-useType" v-if="drugState">
			<view class="zh-table-view">
				<view class="zh-table-view-cell">
					<view class="common-tip">
						<image src="@/pagesSub-Five/static/images/003.png"></image>
						<view>用药方式</view>
					</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">服用方式</view>
					<view class="zh-label-extra">
						<radio-group @change="confirmChange4">
							<label>
								<radio value="in" :checked="!drugStateOut" color="#4DCBBD"
									style="transform:scale(0.7)" /><text>内服</text>
							</label>
							<label style="margin-left: 20rpx;">
								<radio value="out" :checked="drugStateOut" color="#4DCBBD"
									style="transform:scale(0.7)" /><text>外用</text>
							</label>
						</radio-group>
					</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">用法用量</view>
					<view class="zh-label-extra">
						<picker @change="usageDosageChange" :value="usageDosageArrayIndex" :range="usageDosageArray">
							<view class="uni-input">{{usageDosageArray[usageDosageArrayIndex]}}&nbsp;>&nbsp;</view>
						</picker>
					</view>
				</view>
				<view class="zh-table-view-cell" v-if="showUsageDosageIpt">
					<view class="zh-label-extra">
						<input type="text" style="width: 80%;" placeholder="请输入用法与用量" v-model="showUsageDosageIptVaule">
					</view>
				</view>
			</view>
		</view>
		<view class="medicine-confirm-info">
			<view class="zh-table-view">
				<view class="zh-table-view-cell">
					<view class="common-tip">
						<image src="@/static/images/chs.png"></image>
						<view>用药信息确认</view>
					</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">是否使用过此类药物?</view>
					<view class="zh-label-extra">
						<radio-group @change="confirmChange1">
							<label>
								<radio value="是" color="#4DCBBD" style="transform:scale(0.7)" /><text>是</text>
							</label>
							<label style="margin-left: 20rpx;">
								<radio value="否" checked color="#4DCBBD" style="transform:scale(0.7)" /><text>否</text>
							</label>
						</radio-group>
					</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">是否有药物过敏史?</view>
					<view class="zh-label-extra">
						<radio-group @change="confirmChange2">
							<label>
								<radio value="是" color="#4DCBBD" style="transform:scale(0.7)" /><text>是</text>
							</label>
							<label style="margin-left: 20rpx;">
								<radio value="否" checked color="#4DCBBD" style="transform:scale(0.7)" /><text>否</text>
							</label>
						</radio-group>
					</view>
				</view>
				<view class="zh-table-view-cell">
					<view class="zh-label">肝肾功能是否有异常?</view>
					<view class="zh-label-extra">
						<radio-group @change="confirmChange3">
							<label>
								<radio value="是" color="#4DCBBD" style="transform:scale(0.7)" /><text>是</text>
							</label>
							<label style="margin-left: 20rpx;">
								<radio value="否" checked color="#4DCBBD" style="transform:scale(0.7)" /><text>否</text>
							</label>
						</radio-group>
					</view>
				</view>
			</view>
		</view>
		<view class="submit-button-info">
			<view class="zh-table-view">
				<view class="zh-table-view-cell">
					<view class="submit-button" @click="doSubmit">发起问诊</view>
				</view>
			</view>
		</view>
		<uni-popup ref="popup" type="bottom" background-color="#fff">
			<view style="width: 94%;margin-left: 3%">
				<view class="pop-title">选择已确诊疾病</view>
				<view class="symptom-view" style="margin-bottom: 50rpx;">
					<view v-for="(item,index) in symptomArray" :key="item" class="symptom-view-cell"
						@click="symptomChoose(index)" :class="{'symptom-active':item.active}">
						{{item.text}}
					</view>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="popupZY" background-color="#fff">
			<view style="width: 94%;margin-left: 3%">
				<view class="pop-title">症状搜索</view>
				<view class="pop-search">
					<input type="text" placeholder="请输入您的症状" v-model="diagnosisName" />
					<button type="primary" @click="queryDiseaseInfo()">查询</button>
				</view>
			</view>
		</uni-popup>
		<uni-popup ref="popupZYDetail" type="bottom" background-color="#fff">
			<view style="width: 94%;margin-left: 3%;overflow-y: scroll;height: 80vh;">
				<view class="pop-title">选择症状</view>
				<view class="symptom-view" style="margin-bottom: 50rpx;">
					<view v-for="item in symptomArrayZY" :key="item.id" class="symptom-view-cell"
						@click="symptomDetailChoose(item)">
						{{item.text}}
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	// import {
	// 	createConsultation,
	// 	queryConsultation,
	// 	queryDiagnosisName
	// } from '@/utils/api'
	import {
		pressInfo, //就诊人信息、药品信息列表
		create, //发起问诊
		query, //查询上次问诊是否结束
	} from '@/pagesSub-Five/api/index.js';
	import store from '@/store';
	export default {
		data() {
			return {
				isHaveConsultation: false,
				medicineUser: {
					userFamilyName: '', //就诊人姓名
					userFamilyIdCard: '', //就诊人身份证号
					userFamilyIdCard1: '', //就诊人身份证号加密
					userFamilyPhone: '', //就诊人手机号
					userFamilyPhone1: '', //就诊人手机号加密
					status: 1,
					thirdReturnUrl: '/pagesSub/homePage/prescribing/mallorder', //结束问诊后跳回地址
					memberId: '', //问诊人唯一标识（问诊人手机号）
					userFamilyGender: 0, //就诊人性别
					userFamilyAge: 0, //就诊人年龄
					isPregnantWoman: 0, //是否是孕妇
					isLactation: 0, //是否是哺乳期
					relationship: 1, //与您的关系
					serviceType: 0, //服务类型
					isExamine: 1, //是否需要审方（0为不需要，1为需要）
					answerMedicine: [], //药品列表
					storeId: store.state.app.storeId, //门店ID（580提供）
					souceFrom: 0, //来源:0为微信小程序，1为APP，2为H5，3为支付宝小程序
					productList: [], //药品信息(用于问诊结束后，在待支付页面中获取药品信息)
					appPatientResponseBody: {}, //就诊人信息(用于问诊结束后，在待支付页面中获取就诊人信息)
				},
				relationshipArrayIndex: 0,
				targetUrl: '', //发起问诊返回url地址
				relationshipArray: ['本人', '父母', '配偶', '子女', '其他'],
				medicineArray: [],
				symptomArray: [{
					text: '高血压',
					active: false
				}, {
					text: '呼吸道感染',
					active: false
				}, {
					text: '糖尿病',
					active: false
				}, {
					text: '咳嗽',
					active: false
				}, {
					text: '感冒',
					active: false
				}, {
					text: '冠心病',
					active: false
				}, {
					text: '支气管炎',
					active: false
				}, {
					text: '咽炎',
					active: false
				}, {
					text: '心血管综合',
					active: false
				}, {
					text: '牙痛',
					active: false
				}, {
					text: '结膜炎',
					active: false
				}, {
					text: '关节痛',
					active: false
				}, {
					text: '腹泻',
					active: false
				}, {
					text: '尿道炎',
					active: false
				}, {
					text: '牙周炎',
					active: false
				}, {
					text: '关节炎',
					active: false
				}, {
					text: '胃肠炎',
					active: false
				}, {
					text: '胃痛',
					active: false
				}, {
					text: '皮炎',
					active: false
				}, {
					text: '高脂血症',
					active: false
				}, {
					text: '胃炎',
					active: false
				}, {
					text: '幽门螺旋杆菌感染',
					active: false
				}, {
					text: '头痛',
					active: false
				}, {
					text: '扁桃体炎',
					active: false
				}, {
					text: '咽痛',
					active: false
				}, {
					text: '尿路感染',
					active: false
				}, {
					text: '高血脂',
					active: false
				}, {
					text: '痛风',
					active: false
				}, {
					text: '阴道炎',
					active: false
				}, {
					text: '中耳炎',
					active: false
				}, {
					text: '哮喘',
					active: false
				}, {
					text: '前列腺炎',
					active: false
				}, {
					text: '头晕',
					active: false
				}, {
					text: '肠炎',
					active: false
				}, {
					text: '鼻炎',
					active: false
				}, {
					text: '其他',
					active: false
				}],
				symptomSelected: [],
				subjectId3: '否',
				subjectId4: '否',
				subjectId5: '否',
				drugState: false, //false=西药  true=中药
				drugList: [],
				diagnosisName: '',
				symptomSelectedZY: [],
				symptomArrayZY: [],
				drugStateOut: true, //false=内服  true=外用
				usageDosageArrayIndex: 0,
				usageDosageA1: ['水煎服，每日一剂，分早晚两次', '水煎服，每日一剂，分早中晚三次', '水煎服，每日一剂，顿服', '自定义'],
				usageDosageA2: ['水煎外用，每日一剂', '外用，每日一剂', '自定义'],
				usageDosageArray: [],
				showUsageDosageIpt: false,
				showUsageDosageIptVaule: '',
				patientInfo: '', // 就诊人信息
				productList: [], // 药品信息列表
				medicineList: [], //发起问诊药品列表入参
			}
		},
		onShow() {
			// 查询上次问诊是否结束
			this.doQuery();
		},
		onLoad(option) {
			// 上级传参就诊人手机号
			this.medicineUser.memberId = option.phone;
			// 上级页面传递是否为中药，false=西药  true=中药 字符串转Boolean布尔值
			this.drugState = JSON.parse(option.drugState);
			// 上级页面选择的就诊人id
			let patientID = option.patientID;
			// 上级页面传递的药品信息列表
			let productList = JSON.parse(decodeURIComponent(option.productList));
			// 获取就诊人信息、药品信息列表
			this.getPressInfo(patientID, productList);
		},
		methods: {
			// 获取就诊人信息、药品信息列表
			getPressInfo(patientID, productList) {
				let _this = this
				uni.showLoading({
					title: '加载中'
				})
				pressInfo({
					patientId: patientID,
					productList: productList
				}).then(res => {
					uni.hideLoading();
					// 就诊人信息
					_this.patientInfo = res.data.appPatientResponseBody;
					// 药品信息
					_this.productList = res.data.productList;
					// 遍历接口返回药品信息添加部分需要入参数据到一个新的数组中
					_this.productList.forEach(item => {
						let arr = {
							medicineName: item.name,
							imgUrl: item.img,
							spec: item.specification,
							medicineId: item.id,
							number: item.count
						};
						this.medicineList.push(arr)
					})
					// console.log(this.medicineList, '88--')
					// 发起问诊入参数据
					_this.medicineUser = {
						...this.medicineUser,
						userFamilyName: _this.patientInfo.name, //就诊人姓名
						userFamilyIdCard: _this.patientInfo.idCard, //就诊人身份证号
						userFamilyIdCard1: _this.patientInfo.idCard.replace(/^(.{3})(?:\d+)(.{3})$/,
							"$1******$2"), //就诊人身份证号隐藏
						userFamilyPhone: _this.patientInfo.phone, //就诊人手机号隐藏
						userFamilyPhone1: _this.patientInfo.phone.replace(/(\d{3})\d{4}(\d{4})/,
							"$1****$2"), //就诊人手机号隐藏
						memberId: _this.patientInfo.phone, //就诊人唯一标识（就诊人手机号）
						userFamilyGender: _this.patientInfo.sex, //就诊人性别
						userFamilyAge: _this.patientInfo.age, //就诊人年龄
						productList: _this.productList, //药品信息
						appPatientResponseBody: _this.patientInfo, //就诊人信息
					}
				}).catch(err => {
					uni.hideLoading();
					uni.showModal({
						title: '温馨提示',
						content: '【' + err + '】',
						showCancel: false
					})
				});
			},
			// 性别
			genderChange(e) {
				this.medicineUser.userFamilyGender = parseInt(e.detail.value);
			},
			// 是否是孕妇
			pregnantChange(e) {
				this.medicineUser.isPregnantWoman = parseInt(e.detail.value);
			},
			// 是否是哺乳期
			feedChange(e) {
				this.medicineUser.isLactation = parseInt(e.detail.value);
			},
			// 服务类型
			serviceTypeChange(e) {
				this.medicineUser.serviceType = parseInt(e.detail.value);
			},
			// 与您的关系
			relationshipChange(e) {
				this.medicineUser.relationship = parseInt(e.detail.value) + 1;
				this.relationshipArrayIndex = parseInt(e.detail.value);
			},
			// 是否使用过此类药物
			confirmChange1(e) {
				this.subjectId3 = e.detail.value;
			},
			// 是否有药物过敏史
			confirmChange2(e) {
				this.subjectId4 = e.detail.value;
			},
			// 肝功能是否异常
			confirmChange3(e) {
				this.subjectId5 = e.detail.value;
			},
			// 选择已确诊疾病
			symptomChoose(index) {
				this.symptomArray[index].active = !this.symptomArray[index].active;
			},
			// 选择症状
			symptomChooseZY(index) {
				this.symptomSelectedZY.splice(index, 1);
			},
			// 添加症状
			showSymptomMore() {
				this.$refs.popup.open('bottom');
			},
			showSymptomMoreZY() {
				this.diagnosisName = '';
				this.symptomArrayZY = [];
				this.$refs.popupZY.open('bottom');
			},
			clearSymptomSelected() {
				this.symptomArray.forEach(item => {
					item.active = false;
				});
			},
			// 清空症状
			clearSymptomSelectedZY() {
				this.symptomSelectedZY = [];
			},
			// 选择症状
			symptomDetailChoose(item) {
				const that = this;
				item.active = true;
				if (that.symptomSelectedZY.length === 0) {
					that.symptomSelectedZY.push(item);
				} else {
					for (let i = 0; i < that.symptomSelectedZY.length; i++) {
						if (that.symptomSelectedZY[i].id !== item.id) {
							that.symptomSelectedZY.push(item);
						}
					}
				}
				that.$refs.popupZYDetail.close();
			},
			// 用法用量
			usageDosageChange(e) {
				this.usageDosageArrayIndex = parseInt(e.detail.value);
				if ((parseInt(e.detail.value) + 1) === this.usageDosageArray.length) {
					this.showUsageDosageIpt = true;
				} else {
					this.showUsageDosageIpt = false;
				}
			},
			// 服用方法
			confirmChange4(e) {
				const that = this;
				that.usageDosageArrayIndex = 0;
				if (e.detail.value === "out") {
					that.usageDosageArray = that.usageDosageA2
				} else {
					that.usageDosageArray = that.usageDosageA1
				}
			},
			// 判断上次就诊是否结束
			doQuery() {
				const that = this;
				uni.showLoading();
				query(this.medicineUser.memberId,this.medicineUser.storeId).then(res => {
					uni.hideLoading();
					if (res.data.data != null) {
						uni.showModal({
							title: '温馨提示',
							content: '您的上次问诊还未结束，是否继续？',
							showCancel: false,
							success(rt) {
								if (rt.confirm) {
									that.targetUrl = res.data.data.locationUrl
									uni.navigateTo({
										url: './consultation',
										success: function(r) {
											r.eventChannel.emit(
												'acceptDataFromOpenerPage', {
													data: that.targetUrl
												})
										}
									});
								} else {
									that.isHaveConsultation = true;
								}
							}
						})
					} else {
						that.isHaveConsultation = true;
					}
				}).catch(err => {
					uni.hideLoading();
					uni.showModal({
						title: '温馨提示',
						content: '【' + err + '】',
						showCancel: false
					})
				});
			},
			// 发起问诊
			doSubmit() {
				const that = this;
				let param = Object.assign({}, that.medicineUser);
				// 包括已确诊疾病信息、是否使用过此类药物、是否有药物过敏史、肝肾功能是否异常
				param.beforeAiDataList = [];
				// 已确诊疾病
				let answerString = ''
				// 西药处方
				if (!that.drugState) {
					that.symptomSelected = [];
					// 遍历已确诊疾病列表，用户选择的疾病添加到新的数组中，传参使用
					this.symptomArray.forEach(item => {
						if (item.active) {
							that.symptomSelected.push(item.text)
						}
					})
					// console.log(this.symptomSelected, '111---')
					// 判断用户是否选择已确诊疾病（必填项）
					if (that.symptomSelected.length === 0) {
						uni.showModal({
							title: '温馨提示',
							content: '请选择您已确诊的疾病',
							showCancel: false
						});
						return false;
					}
					// 遍历用户选择后的已确诊疾病列表
					that.symptomSelected.forEach(item => {
						answerString += "," + item
					})
					// 已确诊疾病截取字符串
					answerString = answerString.substring(1)
					// console.log(answerString, '西医answerString===')
				} else {
					// 中药处方，用户没有添加症状
					if (that.symptomSelectedZY.length === 0) {
						uni.showModal({
							title: '温馨提示',
							content: '请添加您的症状',
							showCancel: false
						});
						return false;
					}
					// 遍历用户已选择的症状列表
					that.symptomSelectedZY.forEach(item => {
						answerString += "," + item.text
					})
					// 截取症状列表为字符串
					answerString = answerString.substring(1)
					// console.log(answerString, '中医answerString===')
				}
				//已确认疾病
				param.beforeAiDataList[0] = {
					subjectId: 1,
					answer: answerString,
				};
				//药品列表
				param.beforeAiDataList[1] = {
					subjectId: 2,
					answer: '',
					answerMedicine: JSON.stringify(this.medicineList)
				};
				//是否使用过此类药物
				param.beforeAiDataList[2] = {
					subjectId: 3,
					answer: that.subjectId3,
				};
				//是否有药物过敏史
				param.beforeAiDataList[3] = {
					subjectId: 4,
					answer: that.subjectId4,
				};
				//肝功能是否异常
				param.beforeAiDataList[4] = {
					subjectId: 5,
					answer: that.subjectId5,
				};
				// 中药处方判断逻辑
				if (that.drugState) {
					let c = 0;
					that.drugList.forEach(i => {
						c = c + i.number;
					})
					param.dosage = c;
					param.drugState = (that.drugStateOut === true ? 1 : 0);
					if ((that.usageDosageArrayIndex + 1) === that.usageDosageArray.length) {
						param.usageDosage = that.showUsageDosageIptVaule;
					} else {
						param.usageDosage = that.usageDosageArray[that.usageDosageArrayIndex];
					}
				}
				// console.log(param, '发起问诊入参数据---')
				// return
				uni.showLoading({
					title: '加载中'
				})
				create(param).then(res => {
					uni.hideLoading();
					if (res.code == 200) {
						that.targetUrl = res.data.data.locationUrl;
						// that.targetUrl = res.msg;
						uni.navigateTo({
							url: './consultation',
							// url: that.targetUrl,
							success: function(res) {
								res.eventChannel.emit('acceptDataFromOpenerPage', {
									data: that.targetUrl + '&thirdPlatform=0'
								})
							}
						});
					} else {
						uni.showModal({
							title: '温馨提示',
							content: '发起问诊失败【' + res.data.data.errmsg + '】',
							showCancel: false
						})
					}
				}).catch(err => {
					uni.hideLoading();
					uni.showModal({
						title: '温馨提示',
						content: '发起问诊失败【' + err + '】',
						showCancel: false
					})
				});
			},
			// 搜索症状
			queryDiseaseInfo() {
				const that = this;
				if (that.drugState) {
					if (that.diagnosisName.length === 0) {
						uni.showToast({
							icon: 'error',
							title: '请输入您的症状',
						});
						return false;
					}
					let param = {
						pageNum: 1,
						pageSize: 100,
						diagnosisName: that.diagnosisName
					}
					uni.showLoading();
					uni.request({
						method: 'POST',
						header: {
							'content-type': 'application/json'
						},
						url: queryDiagnosisName,
						data: param,
						success: (res) => {
							uni.hideLoading();
							let list = res.data.data.data.list;
							if (list.length > 0) {
								list.forEach(item => {
									that.symptomArrayZY.push({
										text: item.diagnosisName,
										id: item.id,
										icdCode: item.icdCode,
										type: item.type
									})
								})
								that.$refs.popupZY.close();
								that.$refs.popupZYDetail.open('bottom');
							} else {
								that.$refs.popupZY.close();
								uni.showToast({
									icon: 'error',
									title: '未查询到相关症状'
								});
							}
						}
					});
				}
			}
		}
	}
</script>

<style scoped>
	.rx-before-content {
		padding: 30rpx 20rpx;
		height: 100%;
		background-color: #f5f5f5;
	}

	.user-info,
	.symptom-info,
	.medicine-info,
	.medicine-useType,
	.medicine-confirm-info,
	.submit-button-info {
		background-color: #FFF;
		border-radius: 6rpx;
		margin-bottom: 20rpx;
	}

	.zh-table-view {
		position: relative;
	}

	.flexStyle {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.drugImage {
		width: 90rpx;
		height: 90rpx;
		margin-right: 10rpx;
	}

	.zh-table-view-cell {
		position: relative;
		display: flex;
		padding: 30rpx 20rpx;
		flex-direction: row;
		justify-content: space-between
	}

	.zh-table-view-cell:after {
		content: '';
		position: absolute;
		left: 3%;
		right: 0;
		bottom: 0;
		height: 2rpx;
		width: 94%;
		background-color: #f3f3f3;
	}

	.zh-table-view-cell:last-child:after {
		height: 0;
	}

	.common-tip {
		display: flex;
		align-items: center;
		color: #000000;
		font-weight: bold;
		font-size: 30rpx;
	}

	.common-tip image {
		width: 31rpx;
		height: 33rpx;
		margin-right: 10rpx;
	}

	.zh-label {
		color: #333333;
		width: auto;
		font-size: 30rpx;
	}

	.zh-label-extra {
		flex-grow: 1;
		display: flex;
		justify-content: flex-end;
	}

	.zh-label-extra input {
		text-align: right;
	}

	.symptom-view {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		flex-wrap: wrap;
		margin-top: 14rpx;
	}

	.symptom-view-cell {
		border: 1px solid #E0E0E0;
		padding: 10rpx 20rpx;
		flex-grow: 1;
		border-radius: 25rpx;
		margin: 16rpx 20rpx 16rpx 0;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #999999;
		font-size: 28rpx;
	}

	.symptom-active {
		border: 1px solid #4DCBBD;
		color: #4DCBBD;
	}

	.submit-button {
		width: 100%;
		padding: 30rpx auto;
		background-color: #4DCBBD;
		color: #FFF;
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		border-radius: 46rpx;
	}

	.pop-title {
		width: 100%;
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		font-size: 32rpx;
		font-weight: bold
	}

	.pop-search {
		margin-top: 20rpx;
	}

	.pop-search button {
		margin: 50rpx 0;
		background-color: #4DCBBD !important;
		color: #FFF !important;
	}
</style>